<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="warpper"></div>
    <button id="btn">重新加载</button>
    <script>
      var loadImages = function(url, callback) {
        var img = new Image()
        console.log(img.complete)
        img.onload = function() {
          img.onload = null
          callback(img)
        }
        img.src = url
      }

      function test() {
        loadImages(
          'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=4235135478,2071604083&fm=26&gp=0.jpg',
          img => {
            console.log(img)
            document.getElementById('warpper').appendChild(img)
          }
        )
      }
      document.getElementById('btn').onclick = function() {
        test()
      }
    </script>
  </body>
</html>
